<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<style>
    .item-box{
        border: 1px solid #9fbbb4; overflow: hidden; padding:0  3px 0 3px;margin-bottom: 3px;
    }
    .item-box .item-box-title {
        float: left;text-align: center;  font-weight: 800;border-right: 1px solid #9fbbb4;padding: 0 2px 0 0;
    }
    .form-contanier{
        /*height: 50px; line-height: 50px;*/padding: 0 0 0 3px;width: 950px;
    }
    .form-contanier label{
        font-weight: 400;
    }
    .form-contanier label{
        width: 100px;
    }
    .form-contanier span{
        display: inline-block;
        min-width: 90px;
    }
    .form-contanier input{
        width: 100px;
    }
</style>
<script>
    function  autoAdaptHeight() {
        $(".form-contanier").each(function (index,dom) {
            var autoHeight=$(this).closest(".item-box-center").outerHeight(true);
            $(this).css("height",autoHeight);
            $(this).closest(".item-box").find(".item-box-title").each(function (index,dom) {
                $(dom).css("height",autoHeight).css("line-height",autoHeight+"px");
            });
            $(this).closest(".item-box").find(".item-box-right").each(function (index,dom) {
                $(dom).css("height",autoHeight).css("line-height",autoHeight+"px");
            })
        });
    }
    $(function () {
        $(".up_item").find("a").remove();
        autoAdaptHeight();
    });
</script>
<div style="padding: 20px" id="item_container">
    <c:if test="${fn:length(ret)<1}">
        暂无上传资料
    </c:if>
    <c:forEach var="item" items="${ret}" varStatus="retStatus">
        <form id="item_form">
            <div class="item-box">
                <div  class="item-box-title" >
                        ${item.key.name}
                </div>
                <div style="float: left" class="item-box-center">
                    <input  type="hidden" value="${item.value[0].groupId}" name="groupId">
                    <div class="form-contanier">
                            <%--遍历该类型的所有资料类型 例如身份证下面的所有资料类型--%>
                        <c:forEach var="type" items="${item.key.children}" varStatus="status" >
                            <div id="up_item" style="display: inline-block;width: 300px;float: left;min-height:40px;line-height:40px;">
                                <label> ${type.name}:</label>
                                <span class="up_item">
                                <c:choose>
                                    <%--radio类型--%>
                                    <c:when test="${'radiobox'==type.type}">
                                        <c:forEach var="keyValue" items="${type.keyValues}">
                                            <c:forEach var="obj" items="${item.value}"><c:if test="${obj.value==keyValue.value}">${keyValue.label} </c:if></c:forEach>
                                        </c:forEach>
                                    </c:when>
                                    <%--图片类型--%>
                                    <c:when test="${'fileselect'==type.type}">
                                        <%--遍历该类型用户上传的所有资料 例如用户上传的所有身份证资料--%>
                                        <input type="hidden" name="typeId" value="${type.id}" >
                                        <input type="hidden" name="id" value="<c:forEach var="obj" items="${item.value}"><c:if test="${obj.typeId==type.id}">${obj.id}</c:if></c:forEach>" >
                                        <c:set var="oldUrls" value=""></c:set>
                                        <input id="iconvalues${status.index}${retStatus.index}" name="iconvalues"   type="hidden" value="<c:forEach var="obj" items="${item.value}"><c:if test="${obj.typeId==type.id}">${oldUrls}${obj.url}|</c:if></c:forEach>">
                                        <c:set var="oldUrls" value=""></c:set>
                                        <sys:ckfinder input="iconvalues${status.index}${retStatus.index}" type="files" uploadPath="/sys/material/materialUpload" selectMultiple="true"/>
                                    </c:when>
                                    <c:when test="${'textarea'==type.type}">
                                        <input type="hidden" name="typeId" value="${type.id}" />
                                        <input type="hidden" name="id" value="<c:forEach var="obj" items="${item.value}"><c:if test="${obj.typeId==type.id}">${obj.id}</c:if></c:forEach>" />
                                        <textarea type="text" name="value" ><c:forEach var="obj" items="${item.value}"><c:if test="${obj.typeId==type.id}">${obj.value}</c:if></c:forEach></textarea>
                                    </c:when>
                                    <%--普通文本类型--%>
                                    <%--<c:otherwise>--%>
                                        <%--<label><c:forEach var="obj" items="${item.value}"><c:if test="${obj.typeId==type.id}">${obj.value}</c:if></c:forEach></label>--%>
                                    <%--</c:otherwise>--%>
                                    <c:otherwise>
                                        <input type="hidden" name="typeId" value="${type.id}" >
                                        <input type="hidden" name="id" value="<c:forEach var="obj" items="${item.value}"><c:if test="${obj.typeId==type.id}">${obj.id}</c:if></c:forEach>" >
                                        <input type="text" name="value" value="<c:forEach var="obj" items="${item.value}"><c:if test="${obj.typeId==type.id}">${obj.value}</c:if> </c:forEach>"/>

                                    </c:otherwise>
                                </c:choose>
                            </span>
                            </div>
                        </c:forEach>
                    </div>
                </div>
            </div>
        </form>
    </c:forEach>
</div>

